// 教学任务

<template>
  <div>
    <el-table
      :data="tableData"
      style="width: 100%"
      v-loading="isLoading"
      element-loading-text="数据正在加载中"
      element-loading-spinner="el-icon-loading"
      :default-sort="{ prop: 'date', order: 'descending' }"
    >
      <!-- <el-table-column
      prop="index"
      label=""
      sortable
      width="180">
    </el-table-column> -->
      <el-table-column label="专业名称" prop="zymc"> </el-table-column>
      <el-table-column label="学年" prop="xn"> </el-table-column>
      <el-table-column label="学期" prop="xw"> </el-table-column>
      <el-table-column label="课程名称" prop="kcmc"> </el-table-column>
      <el-table-column label="学分" prop="xf"> </el-table-column>
      <el-table-column label="考核方式" prop="khfs"> </el-table-column>
      <el-table-column label="开课院系" prop="kkyx"> </el-table-column>
      <el-table-column label="教师姓名" prop="jsxm"> </el-table-column>
      <el-table-column label="起始周" prop="qsz"> </el-table-column>
      <el-table-column label="结束周" prop="jsz"> </el-table-column>
      <el-table-column label="教材名称" prop="jcmc"> </el-table-column>
      <el-table-column label="作者" prop="zz"> </el-table-column>
      <el-table-column label="出版社" prop="cbs"> </el-table-column>
      <el-table-column label="班级名称" prop="bjmc"> </el-table-column>
      <el-table-column label="专业方向" prop="zyfx"> </el-table-column>
      <el-table-column label="学校名称" prop="xxmc"> </el-table-column>
    </el-table>
    <div class="flexRight">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[10, 15, 20, 30, 40]"
        :page-size="size"
        :layout="mylayout"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import '../../utils/isShowTotalNumber.js'
export default {
  name: "TeachingTaskData",
  data() {
    return {
      mylayout: "",
      isLoading: true,
      tableData: [],
      total: 0,
      size: 15,
      currentPage: 1,
      schoolCode: "",
    };
  },
  created() {
    this.schoolCode = JSON.parse(sessionStorage.getItem("school")).school_code;
    this.getResultData(this.currentPage, this.size);
        this.mylayout = window.mylayout
    // var roleId = JSON.parse(localStorage.getItem("USER")).roleId;
    // if (roleId.includes("99")) {
    //   this.mylayout = "sizes, prev, pager, next";
    // } else {
    //   this.mylayout = "total, sizes, prev, pager, next";
    // }
  },
  mounted() {},
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.size = val;
      this.isLoading = true;
      this.getResultData(this.currentPage, val);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.isLoading = true;
      this.currentPage = val;
      this.getResultData(val, this.size);
    },
    getResultData() {
      let param = {
        // paramMap:{xxdm: this.schoolCode},
        currentPage: this.currentPage,
        size: this.size,
      };
      let that = this
      this.$post2("dataCenter/select/listKCB", JSON.stringify(param)).then(
        (r) => {
          console.log(r.data.records);
          that.total = r.data.total;
          that.isLoading = false;
          that.tableData = r.data.records
        }
      );
    },
  },
};
</script>



